<%--
 *  File:   FileContentRuleDetail.jsp
 *  Date:	2010/07/30        		    
 *  Author: TerryCui
--%>
<%//init param
			String privilegeCode = "E0512";
			String strModuleName = "CM";
			String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@page import="java.util.*" %>
<html>
<head>
<title>FileContentRuleDetail</title>
<PageFlow:CheckPageFlow pageName="p_filecontentruledetail" />
<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/GetUsableColumn.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/PopWindow.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<script>
function page_add(){
	var columnname = cform.columnname.value;
	var checkrule = cform.checkrule.value;

	if(columnname == " "){
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_LineField",false))%>");
		return;
	}

	if(checkrule == " "){
		alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Check_Item",false))%>");
		return;
	}	
	
    cform.actionname.value = "addrule";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_delete(){
	if(nullChecked(document.cform.deleteids,document.cform.numrows.value)){
	  alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
	  return;
	}

	if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>"))
		return;

	cform.actionname.value = "deleterule";
	cform.target = "_self";
	isRunning = true;
	cform.submit();
}
</script>

</head>
<%
	Vector allrules = (Vector)pageContext.getAttribute("allrules"); 
	if(allrules == null){
		allrules = new Vector();
	}
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
<input type="hidden" name="pagename" value="p_filecontentruledetail"> 
<input type="hidden" name="actionname"> 
<custom:hidden property="filecontentruleid" /> 
	

  
<table border=0 cellpadding=0 cellspacing=0 width="100%">
	<tr>
		<td valign=top>
		<table border=0 cellpadding=1 cellspacing=0 width="100%">
			<tr>
				<td bgcolor=#000000
					style="PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 0px">
				<table bgcolor=#000000 border=0 cellpadding=0 cellspacing=0	width="100%">
					<tr>
						<td bgcolor=#ffffff	style="PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 3px">
						<div id=div2 style="HEIGHT: 280px; OVERFLOW: auto">
						<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">

							<%--    top function buttons    --%>
							<%if(!isView){%>
							<tr>
								<td colspan="20" class="td_right">
								<a onclick="page_add();"><custom:button type="2" label="L_Add" imgsrc="add_btn.gif" border="0" /></a> 
								<% if(allrules.size()>0){%>
								<a onclick="page_delete();"><custom:button type="2"	label="L_Delete" imgsrc="delete_btn.gif" border="0" /></a> 
								<%} %>	
								</td>
							</tr>
							<%}%>
							
<!-- table head --start -->
							<tr class="td-listrom">
								<td width="4%">&nbsp;</td>
								<td width="50%" class="td_center"><%= label.getLabelName("L_LineField") %><font color="red">*</font></td>
								<td width="55%" class="td_center"><%= label.getLabelName("L_Check_Item") %><font color="red">*</font></td>
							</tr>
<!-- table head --end -->
<!-- define data  --start -->							
							<%
								Vector allcolumns = (Vector)pageContext.getAttribute("allcolumns"); 
								if(allcolumns == null){
									allcolumns = new Vector();
								}
							%>
							
<!-- define data--end -->
							<% if(allrules.size()>0){%>
							<input type="hidden" name="numrows" value="<%= allrules.size() %>">
<!-- data View --start -->
						<span id="olddetail" >
							<logic:iterate id="onerule" collection="<%= allrules%>" indexId="idx">
								<tr>
								   <td>
								   	<custom:checkbox disabled="<%=isView %>" name="onerule" changedName="deleteids" property="filecontentruledetailid" styleClass="normalradio"/>
								   	<custom:hidden name="onerule" property="columncheckruleid"  colIndex="<%=idx %>"></custom:hidden>
								   </td>
				                   <td><custom:write name="onerule" property="columnname"/></td>
				                   <td><custom:write name="onerule" property="checkrulename"/></td>
				                </tr>
			 				</logic:iterate>
			 			</span>
<!-- data View --end -->
							<%}%>
<!-- add new info row --start -->
							<%if(!isView){%>
							<span id="newdetail" >
	                    		<tr>
									<td>&nbsp;</td>
									 <td><custom:select name="newrule" property="columnname" optionsName="allcolumns" optionValueKey="columnname" optionInnerTextKey="columnname" defaultValueCost=" "  defaultValue="---------------"/></td>
			                        <td><custom:selectdic defaultValueCost=" " defaultValue="---------------"  name="newrule" property="checkrule" dictType="CheckRuleContentType"/></td>
								</tr>
							</span>
							<%}%>
<!-- add new info row --end -->
							
						</table>
						</div>
						</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
</body>
</html>
